import request from "@/utils/request"

const BASE_URL = process.env.VUE_APP_BASE_URL

/**
 * 企业首页
 * @param {*} data
 */
export function adminSystemSaveAPI(data) {
	return request({
		url: BASE_URL + "adminConfig/setAdminConfig",
		method: "post",
		data: data,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

/**
 * 企业首页
 * @param {*} data
 */
export function adminSystemIndexAPI(data) {
	return request({
		url: BASE_URL + "adminConfig/queryAdminConfig",
		method: "post",
		data: data
	})
}

/**
 * 系统信息
 * @param {*} data
 */
export function adminSystemConfigIndexAPI(data) {
	return request({
		url: BASE_URL + "adminConfig/queryCloudConfig",
		method: "post",
		data: data
	})
}

/**
 * 呼叫中心是否开启
 * @param {*} data
 */
export function adminSystemCallSetAPI(data) {
	return request({
		url: BASE_URL + "adminConfig/queryCallModuleSetting",
		method: "post",
		data: data
	})
}

// /**
//  * 忽略系统消息
//  * @param {*} data
//  */
// export function adminConfigIgnoreCompanyStatusAPI() {
//   return request({
//     url: BASE_URL +'adminConfig/ignoreCompanyStatus',
//     method: 'post'
//   })
// }

/**
 * 查询自定义配置
 * @param {*} data
 * CRM下的模块按照 pcCRM + crmType 的规则
 */
export const PcCustomKeys = {
	pcRegisterStatistics: "pcRegisterStatistics", // 注册页面配置信息
	pcCRMprefix: "pcCRM",
	pcMenuStyle: "pcMenuStyle",
	pcUserApp: "pcUserApp", // 无代码模块
	pcMarketingfix: "pcMARKET"
}

export function adminConfigQueryCustomSettingAPI(key) {
	return request({
		url: BASE_URL + `adminConfig/queryCustomSetting/${key}`,
		method: "post"
	})
}

/**
 * 设置自定义配置
 * @param {*} data
 */
export function adminConfigSetCustomSettingAPI(key, data) {
	return request({
		url: BASE_URL + `adminConfig/setCustomSetting/${key}`,
		method: "post",
		data: data,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}
/**
 * 获取企业微信配置参数信息
 * @param {*} data
 */
export function adminWxCorpGetCorpAPI(data) {
	return request({
		url: BASE_URL + `scrmWxWorkConfig/getConfig`,
		method: "post",
		data: data,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}
/**
 * 保存企业微信配置参数信息
 * @param {*} data
 */
export function adminWxCorpSetCorpAPI(data) {
	return request({
		url: BASE_URL + `scrmWxWorkConfig/setConfig`,
		method: "post",
		data: data,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}
/**
 * 同步企业微信配置参数信息
 * @param {*} data
 */
export function adminWxCorpPullWxOrganizationCharAPI() {
	return request({
		url: BASE_URL + `scrmWxWorkConfig/pullOrganization`,
		method: "post",
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}
/**
 * 同步企业微信配置参数信息
 * @param {*} data
 */
export function scrmWxWorkUserAuthorizedUserInformationAPI(data) {
	return request({
		url:
			BASE_URL + `scrmWxWorkUser/authorizedUserInformation?code=${data.code}`,
		method: "post",
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}
/**
 * 同步当前登录用户的客户
 * @param {*} data
 */
export function scrmCustomerSynchronizeWxChatWorkDataAPI() {
	return request({
		url: BASE_URL + `scrmCustomer/synchronizeWxChatWorkData`,
		method: "post",
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

/**
 * 查询增值应用付费状态
 */
export function adminConfigOrderStatusAPI(data) {
	return request({
		url: BASE_URL + `adminConfig/queryModuleApply`,
		method: "post",
		data: data,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

/**
 * 解绑企业微信
 * @param {*} data
 */
export function adminUserUnbindingWxWorkByUserIdAPI(data) {
	return request({
		url: BASE_URL + `adminUser/unbindingWxWorkByUserId`,
		method: "post",
		data: data
	})
}
